import { $post, requestOneFile } from '@js/request'
import { message } from 'antd'

// 上传excel
export async function inputExcelRequest (file: File): Promise<string> {
  const r = await requestOneFile(file)
  const res = await $post('/api/common/input_excel', { fileid: r.id })
  const msg: string = res.message
  const id: string = res.data.import_logid
  if (typeof id === 'string') {
    message.error(msg).then(null, null)
  } else {
    message.success(msg).then(null, null)
  }
  return id
}
